package com.lxl.bt.adapter;

import com.lxl.bt.fragment.MyAgentFragment;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

/**
 * @创建时间 2021/4/14 下午5:03
 * @类描述 一句话描述 你的UI
 */
public class MyAgentAdapter extends FragmentPagerAdapter {

    private String[] titles;
    public MyAgentAdapter(@NonNull FragmentManager fm,String[] titles) {
        super(fm);
        this.titles = titles;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return MyAgentFragment.newInstance(position + 1);
    }

    @Override
    public int getCount() {
        return titles == null ? 0 : titles.length;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
